﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RegisterPanel : BasePanel
{
	InputField idInput;
	InputField pwdInput;
	InputField repInput;
	Button closeBtn;
	Button regBtn;


	public override void OnInit()
	{
		//base.OnInit();
		skinPath = "RegisterPanel";
		type = PanelManager.PanelType.Panel;
	}

	public override void OnShow(params object[] para)
	{
		//base.OnShow(para);

		idInput = skin.transform.Find("IdInput").GetComponent<InputField>();
		pwdInput = skin.transform.Find("PwInput").GetComponent<InputField>();
		repInput = skin.transform.Find("RepInput").GetComponent<InputField>();
		regBtn = skin.transform.Find("RegisterBtn").GetComponent<Button>();
		closeBtn = skin.transform.Find("CloseBtn").GetComponent<Button>();

		regBtn.onClick.AddListener(() => {
			if (string.IsNullOrEmpty(idInput.text) || string.IsNullOrEmpty(pwdInput.text)) return;

			if (repInput.text != pwdInput.text)
			{
				PanelManager.Open<TipPanel>("两次输入的密码不同");
				return;
			}
		});
		closeBtn.onClick.AddListener(() => { Close(); });
	}

	public override void OnClose()
	{
		//base.OnClose();
	}
}
